package com.ews.onlineexchange.model;

import java.util.ArrayList;
import java.util.List;


public enum TradeStatus {
	Opened("已开始", true), Agreed("已成交", false), Passed("流拍", false), Paused("中止", true), Breaked("终止", true), Waiting("待审", true);
	
	private String typeName;
	
	private boolean selectable;

	public String getTypeName() {
		return typeName;
	}

	public boolean isSelectable() {
		return selectable;
	}

	private TradeStatus(String typeName, boolean selectable) {
		this.typeName = typeName;
		this.selectable = selectable;
	}
	
	/*
	 * 获取可被人为操作的状态
	 */
	public static TradeStatus[] selectableValues() {
		List<TradeStatus> results = new ArrayList<TradeStatus>();
		TradeStatus[] values = TradeStatus.values();
		for (int i = 0; i < values.length; i++) {
			if (values[i].selectable)
				results.add(values[i]);
		}
		TradeStatus[] resultArray = new TradeStatus[results.size()];
		results.toArray(resultArray);
		return resultArray;
	}
	
	public static void main(String[] args) {
		System.err.println((char)(5));
	}
}
